package org.nf.web.param;

import jakarta.servlet.ServletRequest;
import org.nf.web.servlet.MethodArgumentsResolver;
import org.nf.web.servlet.ServletApi;

import java.lang.reflect.Parameter;

/**
 * @Author czl
 * @Date 2024-05-17
 */
public class ServletRequestMethodArgumentResolver implements MethodArgumentsResolver {
    @Override
    public boolean supports(Parameter parameter) {
        return ServletRequest.class.isAssignableFrom(parameter.getType());
    }

    @Override
    public Object resolve(Parameter parameter, ServletApi servletApi) {
        return servletApi.request();
    }
}
